import React from 'react';
import {useImmer} from "use-immer";
import {Button} from "antd";

const Index = () => {
    let [value, setValue] = useImmer<Record<string, any>>({
        name: 'hua',
        age: 18,
        gender: ['male', 'female']
    });

    const handleAdd = () => {
        setValue(draft => {
            draft.name = 'li'
            draft.gender = ['male']
        })
    }
    return (
        <>
            <Button onClick={handleAdd}>add</Button>
            <span>{value.name}</span>
            <span>{value.age}</span>
            <span>{value.gender}</span>
        </>
    );
};

export default Index;
